package cn.sumpu.app.guoguojie.web.mvc.mobile;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


import cn.sumpu.app.guoguojie.biz.AppconfBiz;
import cn.sumpu.app.guoguojie.biz.CmsContentBiz;
import cn.sumpu.app.guoguojie.biz.CommentBiz;
import cn.sumpu.app.guoguojie.biz.DiscussBiz;
import cn.sumpu.app.guoguojie.biz.DoingBiz;
import cn.sumpu.app.guoguojie.biz.DoingLoveBiz;
import cn.sumpu.app.guoguojie.biz.DoingTagShowBiz;
import cn.sumpu.app.guoguojie.biz.MemberBiz;
import cn.sumpu.app.guoguojie.biz.MemberDetailBiz;
import cn.sumpu.app.guoguojie.biz.PictorialTopicBiz;
import cn.sumpu.app.guoguojie.biz.TopBiz;
import cn.sumpu.app.guoguojie.constant.DoingProductFrom;
import cn.sumpu.app.guoguojie.domain.CmsContent;
import cn.sumpu.app.guoguojie.domain.Comment;
import cn.sumpu.app.guoguojie.domain.Doing;
import cn.sumpu.app.guoguojie.domain.DoingLove;
import cn.sumpu.app.guoguojie.domain.DoingPictorialTopic;
import cn.sumpu.app.guoguojie.domain.DoingProduct;
import cn.sumpu.app.guoguojie.domain.Member;
import cn.sumpu.app.guoguojie.domain.MemberDetail;
import cn.sumpu.app.guoguojie.domain.PictorialDoing;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;
import cn.sumpu.app.guoguojie.util.Common;
import cn.sumpu.app.guoguojie.util.PageModel;

/**
 * @author sumpu
 * @version $Id: MobileController.java, v 0.1 2012-8-10 上午11:15:46 sumpu Exp $
 */
@Controller
public class MobileController {
    private static Logger   logger = LoggerFactory.getLogger(MobileController.class);
    @Autowired
    private DoingTagShowBiz doingTagShowBiz;
    @Autowired
    private MemberBiz       memberBiz;
    @Autowired
    private MemberDetailBiz memberDetailBiz;
    @Autowired
    private DoingBiz doingBiz;
    @Autowired
    private TopBiz topBiz;
    @Autowired
    private CommentBiz commentBiz;
    @Autowired
    private DoingLoveBiz doingLoveBiz;
    @Autowired
    private PictorialTopicBiz   topicBiz;
    @Autowired
    private CmsContentBiz cmsContentBiz;
    @Autowired
    private DiscussBiz discussBiz;
    @Autowired
    private AppconfBiz appconfBiz;
    
    @RequestMapping(value = "/mobile/shop.htm")
    public String shop(Integer times,String tagId,String type,String spfl,Integer minPrice,Integer maxPrice,String sex , HttpServletResponse response, HttpServletRequest request) throws IOException {
        response.setContentType("text/html; charset=UTF-8");
        List<Map<String, String>> mapList = new ArrayList<Map<String, String>>();
        Map<String,Object> mapRet = new HashMap<String,Object>(); 
        try {
        //    if(StringUtils.isEmpty(spfl))spfl = "boy"; //大分类
         //   String tagId = null; //标签ID
        //    String type = null;//推荐或者最新
        //    Integer minPrice = null;
        //    Integer maxPrice = null;
            Integer page = (times==null)?1:(int)Math.ceil((double)times/10);
            times = times%10;
            if(times == 0){
                times = 10;
            }
            PageModel pageModel = doingTagShowBiz.getGrid(spfl, tagId, StringUtils.isEmpty(type)?"new":type,  page, times, minPrice, maxPrice, null, null, request);

            @SuppressWarnings("unchecked")
            List<Doing> doingList = pageModel.getList();
            if(doingList != null && doingList.size() > 0){
                for (Doing doing : doingList) {
                    Map<String, String> map = new HashMap<String, String>();
                    List<DoingProduct> dpList = doing.getDoingProductList();
                    if (dpList != null && dpList.size() > 0) { 
                        DoingProduct dp = dpList.get(0);
                        map.put("picUrl", dp.getImageServer() + dp.getPicThumb() + "_200xXXX.jpg");
                        map.put("price", String.valueOf(dp.getPrice()));
                        map.put("name", dp.getName());
                        map.put("doingId", doing.getIdentifier());
                        map.put("proId", dp.getIdentifier());
                        mapList.add(map);
                    }

                }
            }
            
            mapRet.put("totalPage", (int)Math.ceil((double)pageModel.getTotalRecord()/12)); 
            mapRet.put("proList", mapList);
            mapRet.put("success", "true");
            
        } catch (Exception e) {
            if (logger.isErrorEnabled()) {
                logger.error("[/mobile/shop.htm] fail", e);
            }
            e.printStackTrace();
            mapRet.put("success", "false");
            mapRet.put("msg", "得到产品列表失败!");
        }
        response.getWriter().print(JSONObject.fromObject(mapRet));
        return null;
    }
    
    
    @RequestMapping(value = "/mobile/mobilemove.htm")
    public void mobileMove(String spfl,String tagId,String type,Integer minPrice,Integer maxPrice,String sex,String mobileMove,String currentDoingId,String pictorialId,HttpServletRequest request, HttpServletResponse response) throws IOException{
        if (Common.empty(mobileMove) || Common.empty(currentDoingId)) 
            return;
        Map<String, String> map = new HashMap<String, String>();
        response.setContentType("text/html; charset=UTF-8"); 
        try {
            Doing doing = null;
            if(StringUtils.isEmpty(pictorialId)){
                PageModel pageModel = doingTagShowBiz.getGrid(spfl, tagId, StringUtils.isEmpty(type)?"new":type,  1, 1, minPrice, maxPrice,mobileMove,currentDoingId, request);
                if (pageModel!=null && pageModel.getList() != null && pageModel.getList().size() > 0) { 
                    doing = (Doing) pageModel.getList().get(0);
                } 
           }else{
                PictorialDoing pd = topicBiz.getPicDoingMobMov(mobileMove, currentDoingId, pictorialId);
                if(pd != null)
                    doing = pd.getDoingObj();
            }
            if(doing != null){
                map.put("success", "true");
                map.put("doingId", doing.getIdentifier());
                List<DoingProduct> dpList = doing.getDoingProductList();
                if(dpList != null && dpList.size() > 0){
                    map.put("proId", dpList.get(0).getIdentifier());
                }
            }else{
                map.put("success", "false");
                map.put("msg", "没有产品了");
            }
        } catch (Exception e) {
            logger.error("[/member/prodetail.htm] fail", e);
            e.printStackTrace();
        }
        response.getWriter().print(JSONObject.fromObject(map));
    }

    @RequestMapping(value = "/mobile/getMember.htm")
    public String getMember(String loginName, String loginPwd, String outLoginMember, HttpServletResponse response, HttpServletRequest request)
                                                                                                                                               throws IOException {
        response.setContentType("text/html; charset=UTF-8");
        Map<String, String> map = new HashMap<String, String>();
        try {
            Member member = memberBiz.login(loginName, loginPwd, Common.getIp(request));
            
            if (member != null) {
                map.put("loginName", loginName);
                map.put("loginPwd", loginPwd);
                map.put("outLoginMember", outLoginMember);
                map.put("followCount", String.valueOf(member.getFollowCount()));
                map.put("fansCount", String.valueOf(member.getFansCount()));
                map.put("loveCount", String.valueOf(member.getLoveCount()));
                map.put("avatar", member.getImageServer()+member.getAvatar());
                map.put("nickname", member.getNickname()); 
                
                MemberDetail memberDetail = memberDetailBiz.getMemberDetailById(member.getIdentifier());
                map.put("sex", memberDetail.getSex()); 
                map.put("intro", memberDetail.getIntroduction());
                map.put("success", "true");
            } else {
                map.put("success", "false");
            }
           
        } catch (Exception e) {
            if (logger.isErrorEnabled()) {
                logger.error("[/mobile/getMember.htm] fail", e);
            }
            e.printStackTrace();
        }
        response.getWriter().print(JSONObject.fromObject(map));
        return null;
    }

    @RequestMapping(value = "/mobile/checkMember.htm")
    public String checkMember(String loginName, String loginPwd, String outLoginMember, HttpServletResponse response, HttpServletRequest request)
                                                                                                                                                 throws IOException {
        response.setContentType("text/html; charset=UTF-8");
        Map<String, String> map = new HashMap<String, String>();
        try {
           Member member = checkMember(loginName, loginPwd, outLoginMember);
            if (member != null) {
                map.put("loginName", loginName);
                map.put("loginPwd", loginPwd);
                map.put("outLoginMember", outLoginMember);
                map.put("success", "true");
            } else {
                map.put("success", "false");
            }
           
        } catch (Exception e) {
            if (logger.isErrorEnabled()) {
                logger.error("[/mobile/checkMember.htm] fail", e);
            }
            e.printStackTrace();
            map.put("success", "false");
        } 
        response.getWriter().print(JSONObject.fromObject(map));
        return null;
    }

    @RequestMapping(value = "/mobile/register.htm")
    public String register(Member member, HttpServletRequest request, HttpServletResponse response)throws IOException {
        Map<String, String> map = new HashMap<String, String>();
        response.setContentType("text/html; charset=UTF-8");
        try {
            Member m = memberBiz.getMemberEmail(member.getEmail());
            if(m != null){
                map.put("success", "false");
                map.put("msg", "邮箱已存在");
            }else{
                Member nickMember = memberBiz.getMemberByNickname(member.getNickname());
                if(nickMember!=null){
                    map.put("success", "false");
                    map.put("msg", "昵称已存在");
                }else{
                    String password = member.getPassword();
                    member.setRegisterIP(Common.getIp(request));
                    member.setLoginIP(Common.getIp(request));
                    member = memberBiz.register(member);
                    map.put("loginName", member.getUsername());
                    map.put("loginPwd", password);
                    map.put("success", "true");
                }
            }
        }catch (Exception e) {
            logger.error("[/mobile/register.htm] fail", e);
            map.put("success", "false");
            map.put("msg", "注册失败");
        }
        response.getWriter().print(JSONObject.fromObject(map));
        return null;
    }
    
    
 // 邮箱验证
    @RequestMapping(value = "/mobile/checkemail.htm")
    public void checkEmail(HttpServletRequest request, HttpServletResponse response) throws IOException{
        Map<String, String> map = new HashMap<String, String>();
        response.setContentType("text/html; charset=UTF-8");
        String email = request.getParameter("email");
        if (Common.empty(email)) return;
        try {
            Member m = memberBiz.getMemberEmail(email);
            if (m != null) {
                map.put("success", "true");
            } else {
                map.put("success", "false");
            }
        } catch (Exception e) {
            logger.error("[/member/checkemail.htm] fail", e);
            e.printStackTrace();
        }
        response.getWriter().print(JSONObject.fromObject(map));
    }

    // 昵称验证
    @RequestMapping(value = "/mobile/checknickname.htm")
    public void checknickname(HttpServletRequest request, HttpServletResponse response, String nickname) throws IOException{
        if (Common.empty(nickname))
            return;
        Map<String, String> map = new HashMap<String, String>();
        response.setContentType("text/html; charset=UTF-8");
        try {
            Member m = memberBiz.getMemberByNickname(nickname);
            if (!Common.empty(m)) {
                map.put("success", "true");
            } else {
                map.put("success", "false");
            }
        } catch (Exception e) {
            logger.error("[/member/checknickname.htm] fail", e);
            e.printStackTrace();
        }
        response.getWriter().print(JSONObject.fromObject(map));
    }

    @RequestMapping(value = "/mobile/setpwd.htm")
    public String setPwd(String loginName,String loginPwd,String outLoginMember,String oldpwd, String newpwd, HttpServletRequest request, HttpServletResponse response) throws Exception{
        Map<String, String> map = new HashMap<String, String>();
        try { 
            Member member  = checkMember(loginName, loginPwd, outLoginMember);
           
            response.setContentType("text/html; charset=UTF-8");
            if (!Common.empty(member)) {
                oldpwd = Common.md5(Common.md5(oldpwd));
                if (oldpwd.equals(member.getPassword())) {
                    member.setPassword(Common.md5(Common.md5(newpwd)));
                    memberBiz.updateMember(member);
                    map.put("success", "true");
                    map.put("info", "修改密码成功");
                }else{
                    map.put("success", "false");
                    map.put("info", "旧密码错误");
                }
                
            } else {
                map.put("success", "false");
                map.put("info", "用户不存在");
            }
        } catch (Exception e) {
            logger.error("[/mobile/setpwd.htm] fail", e);
            e.printStackTrace();
        }
        response.getWriter().print(JSONObject.fromObject(map));
        return null;
    }
    
  //保存基本信息
    @RequestMapping(value = "/mobile/savepersonal.htm")
    public String savePersonal(String loginName,String loginPwd,String outLoginMember,String sex,String intro,HttpServletRequest request, HttpServletResponse response, MemberDetail detail) throws Exception {
        Member member = checkMember(loginName, loginPwd, outLoginMember); 
        Map<String, String> map = new HashMap<String, String>();
        try {
            response.setContentType("text/html; charset=UTF-8");
            if (!Common.empty(member)){
                member.setSex(sex);
                memberBiz.updateMember(member);
                MemberDetail memberDetail = new MemberDetail(); 
                memberDetail.setMember(member.getIdentifier());
                memberDetail.setIntroduction(intro);
                memberDetail.setSex(sex);
                memberDetailBiz.updateMemberDetail(memberDetail);
                map.put("success", "true");
                map.put("msg", "信息修改成功");
                
            } else {
                map.put("success", "false");
                map.put("msg", "用户不存在");
            }
            
            
        } catch (Exception e) {
            logger.error("[/mobile/savepersonal.htm] fail", e);
            e.printStackTrace();
            map.put("success", "false");
            map.put("msg", "更新失败");
        }
        response.getWriter().print(JSONObject.fromObject(map));
        return null;
    }
    
 // 产品详细页
    @RequestMapping(value = "/mobile/prodetail.htm")
    public void prodetail(HttpServletRequest request, HttpServletResponse response, String proId) throws IOException{
        if (Common.empty(proId))
            return;
        Map<String, String> map = new HashMap<String, String>();
        response.setContentType("text/html; charset=UTF-8");
        try {
            DoingProduct doingProduct = doingBiz.getDoingProductById(proId);
            if (!Common.empty(doingProduct)) {
                map.put("success", "true");
                map.put("name", doingProduct.getName());
                map.put("picUrl", doingProduct.getImageServer()+doingProduct.getPicThumb());
                map.put("price", String.valueOf(doingProduct.getPrice()));
            } else {
                map.put("success", "false");
            }
        } catch (Exception e) {
            logger.error("[/member/prodetail.htm] fail", e);
            e.printStackTrace();
        }
        response.getWriter().print(JSONObject.fromObject(map));
    }
    
    @RequestMapping(value = "/mobile/taobaoitem.htm")
    public void taobaoitem(HttpServletRequest request, HttpServletResponse response, String proId,String loginName,String loginPwd,String outLoginMember) throws IOException{
        if (Common.empty(proId))
            return;
        Map<String, String> map = new HashMap<String, String>();
        response.setContentType("text/html; charset=UTF-8");
        try {
            DoingProduct dp = doingBiz.getDpById(proId);
            if (!Common.empty(dp)) {
                Member m = checkMember(loginName, loginPwd, outLoginMember);
                map.put("success", "true");
                String taobaoLink = topBiz.genTaobaoLink(m==null?"guoguojie":m.getIdentifier(), dp.getOriginalId(),true,appconfBiz.getGuoguojieCommissionRate()); 
                if(!StringUtils.isEmpty(taobaoLink)){
                    map.put("linkUrl", taobaoLink);
                }else{ 
                    if(DoingProductFrom.TAOBAO.getValue().equals(dp.getFrom())){
                        map.put("linkUrl", "http://a.m.taobao.com/i"+dp.getOriginalId()+".htm");
                    }else{
                        map.put("linkUrl", dp.getLinkUrl());
                    }
                }
            } else {
                map.put("success", "false");
            }
        } catch (Exception e) {
            logger.error("[/member/prodetail.htm] fail", e);
            e.printStackTrace();
        }
        response.getWriter().print(JSONObject.fromObject(map));
    }
    
    
    
    
    public Member checkMember(String loginName,String loginPwd,String outLoginMember) throws AppBusinessException{
        Member member = null;
        
        if (!Common.empty(outLoginMember)) {
            member = memberBiz.getMemberById(outLoginMember);
        } else {
            member = memberBiz.loginByEmail(loginName, loginPwd);//邮箱登录
            if (null == member) {
                member = memberBiz.loginByNickname(loginName, loginPwd);//昵称登录
            }
        }
        return member;
    }
    
  //评论一条微博
    @RequestMapping(value = "/mobile/addcomment.htm")
    public String addcomment(HttpServletRequest request,HttpServletResponse response,String loginName,String loginPwd,String outLoginMember,Comment comment) throws IOException {
        Map<String, String> map = new HashMap<String, String>();
        response.setContentType("text/html; charset=UTF-8"); 
        try { 
            response.setContentType("text/html; charset=UTF-8");
            Member member = checkMember(loginName, loginPwd, outLoginMember);
            if (member!=null && member.getEnabled()) {
                comment.setMember(member.getIdentifier());
                comment.setPostIp(Common.getIp(request));
                comment.setOwner(member.getFamily());
                comment.setOwnerType(member.getOwnerType());
                commentBiz.insertCommentOrReply(comment);     
               
                map.put("success", "true");
            }
            
        } catch (Exception e) {
            map.put("success", "false");
            map.put("msg", "评论失败");
            logger.error("[/member/addcomment.htm] fail", e);
        }
        response.getWriter().print(JSONObject.fromObject(map));
        return null;
    }
    
  //获取微博评论
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/mobile/getcomment.htm")
    public String getcomment(HttpServletRequest request ,HttpServletResponse response,Integer page,String doingId)throws IOException  {
        Map<String, Object> map = new HashMap<String, Object>();
        response.setContentType("text/html; charset=UTF-8");
        List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
        try {
            PageModel pm = commentBiz.getCommentListByDoingId(doingId, page); 
            request.setAttribute("doingId", doingId);
            request.setAttribute("pm", pm);
            List<Comment> commentList = pm.getList();
            
            for (Comment commentExt : commentList) {
                Map<String,Object> comment = new HashMap<String,Object>();
                comment.put("avatar", commentExt.getMemberImageServer()+commentExt.getMemberAvatar());
                comment.put("username", commentExt.getNickname());
                comment.put("content", commentExt.getContent());
                comment.put("createTime", Common.getDate(commentExt.getGmtCreated()));
                mapList.add(comment);
            }
            map.put("success", "true");
            map.put("list", mapList);
        } catch (AppBusinessException e) {
            map.put("success", "false");
            map.put("success", "获取评论失败！");
            logger.error("[/member/getcomment.htm] fail", e);
            e.printStackTrace();
        }
        response.getWriter().print(JSONObject.fromObject(map));
        return null;
    }
    
    @RequestMapping(value = "/mobile/keep.htm")
    public String keep(HttpServletRequest request ,HttpServletResponse response,String doingId,String loginName,String loginPwd,String outLoginMember)throws IOException  {
        Map<String, Object> map = new HashMap<String, Object>();
        response.setContentType("text/html; charset=UTF-8");
        
        try {
            Member member = checkMember(loginName, loginPwd, outLoginMember); 
            if(member != null){
                DoingLove doingLove = new DoingLove();
                doingLove.setDoing(doingId);
                doingLove.setCreateMember(member.getIdentifier());
                String ret = doingLoveBiz.loveMe(doingLove);
                map.put("success", "true"); 
                if("alreadyLove".equals(ret)){
                    map.put("msg", "您已经收藏过该商品！");
                }else if("loveSuccess".equals(ret)){
                    map.put("msg", "收藏成功！");
                }
                
            }else{
                map.put("success", "false");
                map.put("msg", "收藏失败！");
            }
           
        } catch (AppBusinessException e) {
            map.put("success", "false");
            map.put("msg", "收藏失败！");
            logger.error("[/member/keep.htm] fail", e);
            e.printStackTrace();
        }
        
        response.getWriter().print(JSONObject.fromObject(map));
        return null;
    }
    
    @RequestMapping(value = "/mobile/index.htm")
    public String index(HttpServletRequest request ,HttpServletResponse response)throws IOException  {
        Map<String, Object> map = new HashMap<String, Object>(); 
        response.setContentType("text/html; charset=UTF-8"); 
        List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
        try {
            List<CmsContent> amoyList = discussBiz.getAmoysList(12);
            if(amoyList!= null && amoyList.size() > 0){
                List<DoingPictorialTopic> dptList = new ArrayList<DoingPictorialTopic>();  
                for (CmsContent cmsContent : amoyList) {
                    dptList.addAll(cmsContent.getPictorialList());
                }
                
                if(dptList != null && dptList.size() > 0){
                    for (DoingPictorialTopic doingPictorialTopic : dptList) { 
                        Map<String, Object> dpt = new HashMap<String, Object>();
                        if(doingPictorialTopic.getPictorialObj() != null){
                            dpt.put("cover", doingPictorialTopic.getPictorialObj().getCover());
                            dpt.put("name", doingPictorialTopic.getPictorialObj().getShortTitle());
                            dpt.put("id", doingPictorialTopic.getPictorialObj().getIdentifier());
                            mapList.add(dpt);
                        }
                        
                    }
                }
            }
            
          //首页轮播图
            List<CmsContent> bannerList=cmsContentBiz.getContentList("3fe86f9e-8723-48e5-a898-836e513248f0", 4);
            request.setAttribute("bannerList", bannerList);
            
            
            map.put("success", "true");
            map.put("dptList", mapList);
            map.put("bannerList", bannerList);
           
        } catch (AppBusinessException e) {
            map.put("success", "false");
            map.put("msg", "得到数据失败！");
            e.printStackTrace();
        }
        
        response.getWriter().print(JSONObject.fromObject(map));
        return null;
    }
    
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/mobile/albumdoing.htm")
    public String albumdoing(Integer page,  String pictorialId, HttpServletRequest request, HttpServletResponse response)throws IOException{
        Map<String, Object> map = new HashMap<String, Object>(); 
        response.setContentType("text/html; charset=UTF-8");
        List<Map<String, String>> mapList = new ArrayList<Map<String, String>>();
        int pagesize = 12;
        try {
            page = page == null ? 1 : page;
            PageModel pageModel = topicBiz.getPictorialDoing(pictorialId, page, pagesize);
            List<PictorialDoing> list = pageModel.getList();
            if(list != null && list.size() > 0){
                for (PictorialDoing pictorialDoing : list) {
                    Doing doing = pictorialDoing.getDoingObj();
                    Map<String, String> map2 = new HashMap<String, String>();
                    List<DoingProduct> dpList = doing.getDoingProductList(); 
                    if (dpList != null && dpList.size() > 0) { 
                        DoingProduct dp = dpList.get(0);
                        map2.put("picUrl", dp.getImageServer() + dp.getPicThumb() + "_200xXXX.jpg");
                        map2.put("price", String.valueOf(dp.getPrice()));
                        map2.put("name", dp.getName());
                        map2.put("doingId", doing.getIdentifier());
                        map2.put("proId", dp.getIdentifier());
                        mapList.add(map2);
                    }
                }
            }
            map.put("success", "true");
            map.put("proList", mapList);
            map.put("totalPage", pageModel.getTotalPage());
        } catch (Exception e) {
            map.put("success", "error");
            if (logger.isErrorEnabled()) {
                logger.error("[/mobile/albumdoing.htm] fail", e);
            }
        }
        response.getWriter().print(JSONObject.fromObject(map));
        return null;
    }
    
    @RequestMapping(value = "/mobile/testlink.htm")
    public String testlink(HttpServletRequest request ,HttpServletResponse response)throws IOException  {
        response.sendRedirect("http://a.m.taobao.com/i12253348464.htm?ali_trackid=2:mm_29539540_0_0:1346378207_4k6_1988425838&spm=2014.21080975.1.0&f=tk&sk=353612032147261407");
        return null;
    }
    
    public static void main(String[] args) {
      //  System.out.println(Math.ceil((double)9/10));
    }
}
